package com.hujf.mapreduce.join;

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.NullWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Job;
import org.apache.hadoop.mapreduce.lib.input.FileInputFormat;
import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat;

import java.io.IOException;

/**
 * @author Hujf
 * @title: LogDriver
 * @date 2021/4/110:23
 * @description: TODO
 */
public class LogDriver {
    public static void main(String[] args) throws IOException, ClassNotFoundException, InterruptedException {
        //1.获得job
        Job job = Job.getInstance(new Configuration());

        job.setJarByClass(LogDriver.class);

        //3.关联mapper和reduce
        job.setMapperClass(JoinMapper.class);
        job.setReducerClass(JoinReducer.class);

        job.setMapOutputKeyClass(Text.class);
        job.setMapOutputValueClass(TableBean.class);

        job.setOutputKeyClass(TableBean.class);
        job.setOutputValueClass(NullWritable.class);

        FileInputFormat.setInputPaths(job,new Path("F:\\hbase\\data\\input\\join"));
        FileOutputFormat.setOutputPath(job,new Path("F:\\hbase\\data\\output26"));

        job.waitForCompletion(true);
    }
}
